<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/4/11
 * Time: 11:44
 */

use yii\helpers\Html;
use yii\grid\GridView;
use \yii\helpers\Url;

/* @var $this yii\web\View */

$this->title = Yii::t('app', '管理员');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="category-index">
    <input type="hidden" value="<?php echo Yii::$app->request->csrfToken; ?>" name="<?= Yii::$app->request->csrfParam?>">
    <p>
        <?= Html::a(Yii::t('app', '新增管理员'), ['edit'], ['class' => 'btn btn-success']) ?>
    </p>
    <table class="table table-hover table-bordered">
        <thead>
        <tr>
            <th>id</th>
            <th>用户</th>
            <th>昵称</th>
            <th>手机</th>
            <th>邮箱</th>
            <th>登录IP</th>
            <th>登录时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <?php foreach ($list as $item): ?>
            <tr>
                <td><?= $item->id ?></td>
                <td><?= $item->username ?></td>
                <td><?= $item->name ?></td>
                <td><?= $item->mobile ?></td>
                <td><?= $item->email ?></td>
                <td><?= $item->login_ip ?></td>
                <td><?= $item->login_time ? date('Y-m-d H:i', $item->login_time) : '-' ?></td>
                <td>
                    <a href="<?= Url::to(['/user/edit', 'id' => $item->id]) ?>" class="btn btn-primary">编辑</a>
                    <button class="btn btn-danger ajax-click"
                            data-callback="location.reload();"
                            data-url="<?= Url::to(['/user/del', 'id' => $item->id]) ?>">删除
                    </button>
                </td>
            </tr>
        <?php endforeach; ?>
        </tbody>
    </table>
    <section class="panel panel-default">
        <header class="panel-heading"> DataTables <i class="fa fa-info-sign text-muted" data-toggle="tooltip"
                                                     data-placement="bottom" data-title="ajax to load the data."></i>
        </header>
        <div class="table-responsive">
            <table class="table table-striped m-b-none" data-ride="datatables"
                   data-cols="id,username,name,mobile,email,login_ip,login_time,_"
                   data-ac="id,用户,昵称,手机,邮箱,登录IP,登录时间,操作">
                <thead>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>
    </section>

</div>
